/* eslint-disable import/no-anonymous-default-export */
import { Navigate, useRoutes } from 'react-router-dom'
// import React, { lazy, Suspense } from 'react'
import PublicLayout from '../layout/index'
import Home from '../view/home'
import Find_password from '../view/Find_password/Find_password'
import Login from '../view/login/login'
import Register from '../view/Register/Register'
import Usermannge from '../view/usermannge/usermannge'
import Fieldmanagement from '../view/Fieldmanagement/Fieldmanagement'
import Animalmanagement from '../view/Animalmanagement/Animalmanagement'
// import Veterinary from '../view/Veterinary/Veterinary'
import Disinfectionmanagement from '../view/Disinfectionmanagement/Disinfectionmanagement'
import Productionrecords from '../view/Productionrecords/Productionrecords'
import Medicalrecord from '../view/medicalrecord/medicalrecord'
import Measurementmanagement from '../view/measurementmanagement/measurementmanagement'
import Euthanasia from '../view/euthanasia/euthanasia'
import Error from '../view/Error/error'


const routes = [
  // 重定向
  {
    path: '/',
    element: <Navigate to="/login" />
  },
  // 登录
  {
    path: '/login',
    element: <Login />
  },
  {
    path: '/Register',
    element: <Register />
  },
  {
    path: '/Error',
    element: <Error />
  },
  {
    element: <PublicLayout />,
    children: [
      // 主页
      {
        path: '/home',
        element: <Home />
      },
      {
        path: '/find_password',
        element: <Find_password />
      },
      // 客户建档
      {
        path: '/usermannge',
        element: <Usermannge />
      },
      // 健康风险评估
      {
        path: '/Fieldmanagement',
        element: <Fieldmanagement />
      },
      // 健康智能分析
      {
        path: '/Animalmanagement',
        element: <Animalmanagement />
      },
 
      {
        path: '/Disinfectionmanagement',
        element: <Disinfectionmanagement />
      },

      {
        path: '/Productionrecords',
        element: <Productionrecords />
      },

      {
        path: '/medicalrecord',
        element: <Medicalrecord />
      },

      {
        path: '/measurementmanagement',
        element: <Measurementmanagement />
      },
 
    ]
  },
  {
    path: "*",
    element: <Navigate to="/Error" />
  },
  
]

const Router = () => {
  const router = useRoutes(routes);
  return router
}

export default Router